import 'package:flutter/material.dart';

class GestureTap extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          Container(
              padding: EdgeInsets.all(15),
              color: Colors.lightBlueAccent,
              child: GestureDetector(
                onTap: (){
                  Scaffold.of(context).showSnackBar(
                      SnackBar(
                        content: Text("点击了文本"),
                      )
                  );
                },
                child: Text("点击事件",style: TextStyle(color: Colors.white,fontSize: 16),),
              )
          ),
          Container(
            margin: EdgeInsets.only(top: 20),
            child: GestureDetector(
              onTap: (){
                Scaffold.of(context).showSnackBar(
                  SnackBar(content: Text("点击了图标"))
                );
              },
              child: Icon(Icons.near_me,color: Colors.blue,size: 40,),
            ),
          ),
        ],
      ),
    );
  }
}
